package entity;

import dao.ContaCorrenteDAO;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

public  class ContaCor extends Conta {
    
    private double depositoInicial;
    private double limite;
    private int numContaCor;
    private int dono;

    public double getDepositoInicial() {
        return depositoInicial;
    }

    public void setDepositoInicial(double depositoInicial) {        
        this.depositoInicial = depositoInicial;        
    }

    public double getLimite() {
        return limite;
    }

    public void setLimite(double limite) {
        this.limite = limite;
    }

    public int getNumContaCor() {
        return numContaCor;
    }

    public void setNumContaCor(int numContaCor) {
        this.numContaCor = numContaCor;
    }
    
    @Override
    public boolean saca (double valor) {
        if (valor > limite) {
            return false;
        } else {
            ContaCorrenteDAO dao = new ContaCorrenteDAO();
            try {
                dao.saca(valor, dono);
            } catch (SQLException ex) {
                Logger.getLogger(ContaCor.class.getName()).log(Level.SEVERE, null, ex);
            }
            return true;
        }
    }
    
    
    @Override
    public void remunera() {
        super.saldo = super.saldo * 1.01;       
    }
    
    public void setDono(int dono) {
        this.dono = dono;
    }
}
